package dnl.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;

import dnl.util.ui.ProgressDialog;

public class ProgressDialogTestApp {
	public static void main(String[] args) {
		Runnable r = new Runnable() {
			@Override
			public void run() {

				final JFrame jf = new JFrame();
				jf.setSize(300, 300);
				JButton jb = new JButton("AAA");
				jb.addActionListener(new ActionListener() {
					@Override
					public void actionPerformed(ActionEvent e) {
						Runnable r = new Runnable() {
							@Override
							public void run() {
								for (int i = 0; i < 101; i++) {
									final int k = i;
									ProgressDialog.showProgress(jf, "sdfsdf ", k);
									try {
										Thread.sleep(100);
									} catch (InterruptedException e) {
										e.printStackTrace();
									}
								}
							}
						};
						new Thread(r).start();
					}
				});
				JPanel jp = new JPanel();
				jf.setContentPane(jp);
				jp.add(jb);
				JProgressBar progressBar = new JProgressBar();
				progressBar.setValue(33);
				jp.add(progressBar);
				jf.setVisible(true);
			}
		};
		SwingUtilities.invokeLater(r);
	}
}
